<?php

/* @auther wf
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

class Nojoin {
	public $conn;
	public function __construct() {
		$this->conn = Yii::app()->db;
	}
	/**
     * 得到所有不统计规则
     * @version 1.0
     * @date 2013-12-14
     * @author wf
     */
	static public function _getNojoinAll() {
		$sql = ' SELECT "id","name" FROM "{{nojoinrule}}" WHERE "is_del"=0';
		$data = Yii::app()->db->createCommand($sql)->queryAll();
		return $data;
	}
	/**
     * 得到所有学校
     * @version 1.0
     * @date 2013-12-14
     * @author wf
     */
static	public function _getschoolAll($where='') {
		$sql = ' SELECT * FROM "{{school}}" '.$where;
		$data = Yii::app()->db->createCommand($sql)->queryAll();
		return $data;
	}
	/**
     * 得到所有科目
     * @version 1.0
     * @date 2013-12-14
     * @author wf
     */
	static public function _getsubjectAll($where='') {
		$sql = ' SELECT * FROM "{{subject}}" '.$where;
		$data = Yii::app()->db->createCommand($sql)->queryAll();
		return $data;
	}
	/**
     * 判断数值是否在二维数组中
     * @version 1.0
     * @date 2013-12-14
     * @author wf
     */
static	public function _getvalueALL($check,$checkarray) {
		foreach ($checkarray as $k=>$v){
			$stute = in_array($check,$v);
			if ($stute==1){
				return 1;
				break;
			}else {
				$stute =0;
			}
		}
		return $stute;
	}
	/**
     * 得到指定项目的选择学校id
     * @version 1.0
     * @date 2013-12-14
     * @author wf
     */
    static	public function _getexam_schoolALL($where='') {
		$sql = ' SELECT * FROM "{{exam_school}}" '.$where;
		$data = Yii::app()->db->createCommand($sql)->queryAll();
		return $data;
	}
	/**
     * 得到上报DBF信息
     * @version 1.0
     * @date 2013-12-14
     * @author wf
     */
    static	public function _getreportruleALL($where='') {
		$sql = ' SELECT * FROM "{{reportrule}}" '.$where;
		$data = Yii::app()->db->createCommand($sql)->queryAll();
		return $data;
	}
	/**
     * 不参加统计筛选规则
     * @version 1.0
     * @date 2013-12-14
     * @author wf
     */
	static public function _getnojointuleconfig_row() {
		return array(
		"student_name"=>"姓名",
		"exam_code"=>"准考号",
		"city_code"=>"城市代码",
		"city_name"=>"城市简称",
		"school_code"=>"学校代码",
		"school_name"=>"学校名称",
		"class_name"=>"班级名称",
		"student_sex"=>"性别",
		"disciplin_code"=>"科别代码",
		"disciplin_name"=>"科别名称",
		"statis"=>"是否统计",
		"nature"=>"学校性质",
		"interstellar"=>"学校星级",
		"roll"=>"学籍号",
		"track"=>"跟踪号"
		);
	}
	/**
     * 不参加统计筛选规则
     * @version 1.0
     * @date 2013-12-14
     * @author wf
     */
	static public function _getnojointuleconfig_where($id='') {
		if($id == 1){
			return array(
			"ywkgf"=>"语文客观分",
			"ywzgf"=>"语文主观分",
			"ywzwf"=>"语文作文分",
			"ywfjf"=>"语文附加分",
			"ywf"=>"语文总分",
			"sxtkf"=>"数学填空",
			"sxjdf"=>"数学解答",
			"sxfjf"=>"数学附加",
			"sxf"=>"数学总分",
			"yykgf"=>"英语客观分",
			"yyzgf"=>"英语主观分",
			"yyzwf"=>"英语作文分",
			"yyf"=>"英语总分",
			"yswzf"=>"语数外总分",
			"yswzfhfjf"=>"语数外总分（含附加分）",
			"wlkgf"=>"物理客观分",
			"wlzgf"=>"物理主观分",
			"wlf"=>"物理总分",
			"hxkgf"=>"化学客观分",
			"hxzgf"=>"化学主观分",
			"hxf"=>"化学总分",
			"swkgf"=>"生物客观分",
			"swzgf"=>"生物主观分",
			"swf"=>"生物总分",
			"lskgf"=>"历史客观分",
			"lszgf"=>"历史主观分",
			"lsf"=>"历史总分",
			"zzkgf"=>"政治客观分",
			"zzzgf"=>"政治主观分",
			"zzf"=>"政治总分",
			"dlkgf"=>"地理客观分",
				"dlzgf" => "地理主观分",
				"dlf" => "地理总分"
			);
		}else{
			return array(
			"ywkgf"=>"语文客观分",
			"ywzgf"=>"语文主观分",
			"ywzwf"=>"语文作文分",
			"ywfjf"=>"语文附加分",
			"sxtkf"=>"数学填空",
			"sxjdf"=>"数学解答",
			"sxfjf"=>"数学附加",
			"yykgf"=>"英语客观分",
			"yyzgf"=>"英语主观分",
			"yyzwf"=>"英语作文分",
			"wlkgf"=>"物理客观分",
			"wlzgf"=>"物理主观分",
			"hxkgf"=>"化学客观分",
			"hxzgf"=>"化学主观分",
			"swkgf"=>"生物客观分",
			"swzgf"=>"生物主观分",
			"lskgf"=>"历史客观分",
			"lszgf"=>"历史主观分",
			"zzkgf"=>"政治客观分",
			"zzzgf"=>"政治主观分",
			"dlkgf"=>"地理客观分",
				"dlzgf" => "地理主观分"
			);
		}
	}
	
    /**
     * 获取栏位对应的不重复的值
     * @version 1.0
     * @date 2013-12-14
     * @author wf
     */
	static function _getstudentrow($key='') {
		$sql = 'SELECT "'.$key.'" FROM "{{student}}" GROUP BY "'.$key.'"';
		$data = Yii::app()->db->createCommand($sql)->queryAll();
		return $data;
	}
}

?>
